//
// Created by ds on 24-6-26.
//

#ifndef UTILS_H
#define UTILS_H
#include "Entity.h"
#include <fedtime.hh>
#include <vector>
#include "easylogging++.h"

namespace Utils {
    int logConfig(int argc, const char *argv[]);

    Ns3Arguments parameterAnalysis(int argc, const char *argv[]);

    std::vector<std::string> splitString(const std::string &str, char delimiter);

    std::vector<int> splitStringToInt(const std::string &str, char delimiter);

    namespace Number {
        constexpr static const double eps = 1e-6;

        bool lessThan(double left, double right);

        bool lessThan(double left, const RTIfedTime &right);

        bool lessThan(const RTIfedTime &left, double right);

        bool moreThan(double left, const RTIfedTime &right);

        int randomInt(int min, int max);
    }

    namespace Transform {
        string rtiValueToString(const RTI::ParameterHandleValuePairSet &theParameters, int i, string *value,
                                RTI::ULong valueLength);

        string rtiValueToString(const RTI::AttributeHandleValuePairSet &theParameters, int i, string *value,
                                RTI::ULong valueLength);

        double rtiValueToDouble(const RTI::ParameterHandleValuePairSet &theParameters, int i, string *value,
                                RTI::ULong valueLength);

        double rtiValueToDouble(const RTI::AttributeHandleValuePairSet &theParameters, int i, string *value,
                                RTI::ULong valueLength);

        int rtiValueToInt(const RTI::ParameterHandleValuePairSet &theParameters, int i, string *value,
                          RTI::ULong valueLength);
    }
}

#endif //UTILS_H
